home *** CD-ROM | disk | FTP | other *** search
/ Aminet 7 / Aminet 7 - August 1995.iso / Aminet / comm / net / DialupV3_03.lha / dialup / dialup.h < prev    next >
C/C++ Source or Header  |  1994-10-16  |  3KB  |  138 lines

  1. ;/*
  2. Failat 1
  3. SC MAKEGST dialup.gst NOLINK dialup.h
  4. QUIT $RC
  5. */
  6.  
  7. #include <exec/types.h>
  8. #include <exec/memory.h>
  9. #include <exec/libraries.h>
  10. #include <exec/devices.h>
  11. #include <dos/dos.h>
  12. #include <devices/serial.h>
  13. #include <devices/timer.h>
  14. #include <devices/sana2.h>
  15. #include <exec/errors.h>
  16. #include <intuition/intuition.h>
  17. #include <usesysbase.h>
  18. /* delete this line or put '#define __USE_SYSBASE' in this file, it's neccessary if you do a GST */
  19. /* MGST ignores any #defines and declarations in the .c file since it is precompiling your HEADER FILES. */
  20. /* Library Reference Manual, Chapter 4, Page 30 */
  21. #include <proto/exec.h>
  22. #include <proto/dos.h>
  23. #include <proto/intuition.h>
  24. #include <stdio.h>
  25. #include <stdarg.h>
  26. #include <string.h>
  27. #include <math.h>
  28.  
  29. struct SP {
  30.     UBYTE    serDevName[100];
  31.     ULONG    serUnit;
  32.     ULONG    serBaudRate;
  33.     BOOL    listen2CD;
  34.     BOOL    serHWHS;
  35.     };
  36.  
  37. struct argspec
  38.     {
  39.     const UBYTE        *name;
  40.     LONG            deflt;
  41.     };
  42.  
  43. enum argnames {
  44.     A_CMD,
  45.     A_PN,
  46.     A_RDD,
  47.     A_MCT,
  48.     A_RGS,
  49.     A_WBW,
  50.     A_WUS,
  51.     A_LIP,
  52.     A_LTO,
  53.     A_LIN,
  54.     A_PWP,
  55.     A_PW,
  56.     A_SLIP,
  57.     A_SLIN,
  58.     A_SPWP,
  59.     A_SPW,
  60.     A_LOK,
  61.     A_LOT,
  62.     A_VERBOSE,
  63.     A_TEST,
  64.     A_NSI,
  65.     A_NDI,
  66.     A_RPF,
  67.     A_QUIET,
  68.     A_STE,
  69.     A_AA,
  70.     A_NRC,
  71.     A_SAD,
  72.     A_SAU,
  73.     A_SCF,
  74.     A_CS,
  75.     A_MSC,
  76.     A_MSH,
  77.     A_MQC,
  78.     A_MRC,
  79.     A_MHC,
  80.     A_MOK,
  81.     A_MNC,
  82.     A_MLB,
  83.     A_MLD,
  84.     A_MRG,
  85.     A_MAC,
  86.     A_MAAC,
  87.     A_MOC,
  88.     A_MLC,
  89.     A_MTC,
  90.     A_MTO,
  91.     A_MOH,
  92.     A_ALL,
  93.     A_END
  94.  };
  95.  
  96. #define WS(string) (string), sizeof(string)
  97. #define ABBREV(arg, key) ( !strnicmp( ( arg ), ( key ), strlen( key ) ) )
  98. #define CUP(msgstr, res)                {msg(msgstr);                    result = (res); goto cleanup;}
  99. #define CUP1(msgstr, arg1, res)            {msg((msgstr), (arg1));            result = (res); goto cleanup;}
  100. #define CUP2(msgstr, arg1, arg2, res)    {msg((msgstr), (arg1), (arg2)); result = (res); goto cleanup;}
  101. #define MAXMATCHSTRING 10
  102. #define VARBUFSIZE 3000
  103. #define TEMPLATESIZE 1000
  104. #define RXBUFSIZE 10000
  105. #define SERPORTNAME "TheOneAndOnlySLIPPort"
  106. #define BREAKSTR "\n*BREAK*\n"
  107. #define VERIFY(fr) { if ( !(fr) ) return(FALSE); }
  108. #define _OK_ {return(TRUE);}
  109. #define _FAIL_ {return(FALSE);}
  110. #define loop for(;;)
  111.  
  112. BOOL    query(UBYTE *varbuf);
  113. BOOL    hangup(UBYTE *varbuf);
  114. BOOL    connect(UBYTE *varbuf);
  115. BOOL    take(UBYTE *varbuf);
  116. BOOL    commandmode(UBYTE *varbuf);
  117. BOOL    dropline(UBYTE *varbuf);
  118. BOOL    carrier(void);
  119. BOOL    checkconnect(UBYTE *buf);
  120. BOOL    unique(struct MsgPort *serport);
  121. void    initDefaultsAndTemplate(UBYTE *);
  122. BOOL    initDefaultsTemplate(UBYTE *, LONG argd[]);
  123. void    showdefaults(LONG argd[]);
  124. BOOL    initSerialLine(struct SP *serpara);
  125. void    buildMatchStringArray( UBYTE *pattern, UBYTE *buf, UBYTE *msa[] );
  126. UBYTE * matchString( UBYTE *string, UBYTE *msa[]);
  127. UBYTE *    sStrMatch(UBYTE *string, UBYTE *pattern, UBYTE *buf);
  128. BOOL    sendLine(    UBYTE *send );
  129. BOOL    sendToSer(    UBYTE *send );
  130. UBYTE *    expectFromSer(             UBYTE *expect, USHORT timeout );
  131. UBYTE *    exSend(                     UBYTE *expect, USHORT timeout, UBYTE *send );
  132. UBYTE *    sendEx(        UBYTE *send, UBYTE *expect, USHORT timeout );
  133. void    adjustdefs(void);
  134.  
  135. BOOL    ReadConfig(STRPTR sanacfgfile, USHORT sanaUnit, struct SP *sp);
  136. VOID    msg(UBYTE *msgstr, ...);
  137. VOID    kprintf(UBYTE *msgstr, ...);
  138.